<{include file="header.htm"}>

<script type="text/javascript">
	$(function(){
		layer.open({
			type: 2
			,content: '支付中...'
		});
	});

	function jsApiCall()
	{
		layer.closeAll();
		WeixinJSBridge.invoke(
				'getBrandWCPayRequest',
				{
					"appId": "<{$jsApiParameters.appId}>", //公众号名称，由商户传入
					"timeStamp": "<{$jsApiParameters.timeStamp}>", //时间戳
					"nonceStr": "<{$jsApiParameters.nonceStr}>", //随机串
					"package": "<{$jsApiParameters.package}>", //扩展包
					"signType": "<{$jsApiParameters.signType}>", //微信签名方式:1.sha1
					"paySign": "<{$jsApiParameters.paySign}>"//微信签名
				},
				function(res) {
				if (res.err_msg == "get_brand_wcpay_request:ok") {
				alert("支付成功");
				window.location.href="<{$config.weburl}>/main.php?m=product&s=admin_buyorder";
			} else if (res.err_msg == "get_brand_wcpay_request:cancel") {
					alert("支付取消");
				window.location.href="<{$config.weburl}>/main.php?m=product&s=admin_buyorder";
			} else {

				window.location.href="<{$config.weburl}>/main.php?m=product&s=admin_buyorder";
			}
					
				}
		);
	}
	if (typeof WeixinJSBridge == "undefined") {
		if (document.addEventListener) {
			document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
		} else if (document.attachEvent) {
			document.attachEvent('WeixinJSBridgeReady', jsApiCall);
			document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
		}
	} else {
		jsApiCall();
	}
	
	
	

</script>

<{include file="footer.htm"}>